/*
 * Project: Set Sample
 * Copyright (C) 2014 alf.labs gmail com,
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.alflabs.setsample.ui;

import android.widget.Button;
import com.alflabs.setsample.R;
import com.alflabs.setsample.SoloTestCase;

//-----------------------------------------------

public class IntroActivityTestsolo extends SoloTestCase<IntroActivity> {

    private static final String TAG = IntroActivityTestsolo.class.getSimpleName();

    /** The package being tested */
    private static final String TARGET_PKG_NAME = "com.alflabs.setsample";

    public IntroActivityTestsolo() {
        super(TARGET_PKG_NAME, IntroActivity.class);
    }

    public void testShouldNotBeNull() {
        assertNotNull(mActivity);

        Button btnSettings = (Button) mActivity.findViewById(R.id.btnSettings);
        assertNotNull(btnSettings);

        Button btnHelp = (Button) mActivity.findViewById(R.id.btnHelp);
        assertNotNull(btnHelp);

        Button btnStats = (Button) mActivity.findViewById(R.id.btnStats);
        assertNotNull(btnStats);

        Button btnPlay = (Button) mActivity.findViewById(R.id.btnPlay);
        assertNotNull(btnPlay);
    }

    public void testCallSettings() {
        assertEquals(1, monitorActivityStart(SettingsActivity.class, new Runnable() {
            @Override
            public void run() {
                Button btn = (Button) mActivity.findViewById(R.id.btnSettings);
                btn.performClick();
            }
        }));
    }

    public void testCallHelp() {
        assertEquals(1, monitorActivityStart(HelpActivity.class, new Runnable() {
            @Override
            public void run() {
                Button btn = (Button) mActivity.findViewById(R.id.btnHelp);
                btn.performClick();
            }
        }));
    }

    public void testCallStats() {
        assertEquals(1, monitorActivityStart(SetStatsActivity.class, new Runnable() {
            @Override
            public void run() {
                Button btn = (Button) mActivity.findViewById(R.id.btnStats);
                btn.performClick();
            }
        }));
    }

    public void testCallPlay() {
        assertEquals(1, monitorActivityStart(SetActivity.class, new Runnable() {
            @Override
            public void run() {
                Button btn = (Button) mActivity.findViewById(R.id.btnPlay);
                btn.performClick();
            }
        }));
    }
}
